package com.ta.shortTestCode;

import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.content.Intent;
import android.widget.AdapterView.OnItemClickListener;
import android.view.*;

public class ShortTestCodeActivity extends Activity {
	private String[] strFunctionLists;

	static final int INT_IMAGE_THUMB = 0;
	static final int INT_FILE_DIALOG = 1;
	static final int INT_RES_IMAGE_THUMB = 2;
	static final int INT_BLUETOOTH_CHAT = 3;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		strFunctionLists = this.getResources().getStringArray(R.array.functionslist);

		ListView lv = (ListView)this.findViewById(R.id.lstMenu);  
		lv.setAdapter(new ArrayAdapter<String>(getApplicationContext(), R.layout.list_item, strFunctionLists));
		lv.setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> _av, View _v, int _index, long _id) {
				ProcessClick(_index);
			}
		});
	}

	private void ProcessClick(int pintIndex)
	{
		switch(pintIndex)
		{
		case INT_IMAGE_THUMB:
			Intent i = new Intent(ShortTestCodeActivity.this, ImageThumbnailsActivity.class);
			startActivity(i);
			break;
		case INT_FILE_DIALOG:
			Intent ifile = new Intent(ShortTestCodeActivity.this, FileOpenDialog.class);
			startActivity(ifile);
			break;
		case INT_RES_IMAGE_THUMB:
			Intent iresimg = new Intent(ShortTestCodeActivity.this, ResImageThumbnail.class);
			startActivity(iresimg);
			break;
		case INT_BLUETOOTH_CHAT:
			Intent iresbluetooth = new Intent(ShortTestCodeActivity.this, BluetoothChat.class);
			startActivity(iresbluetooth);
			break;
		}		  
	}

	@Override
	public Dialog onCreateDialog(int id) {
		/*switch(id) {
	      case (C6_FILE) :        
	        LayoutInflater li = LayoutInflater.from(getApplicationContext());
	        View filelsview = li.inflate(R.layout.fileloadsave, null);

	        AlertDialog.Builder quakeDialog = new AlertDialog.Builder(this);//(getApplicationContext());
	        quakeDialog.setTitle("Quake Time");         
	        quakeDialog.setView(filelsview);
		      return quakeDialog.create();
	    }
		 */
		return null;
	}

}